<?php

/**
 * wfWorkflowWorkItem form base class.
 *
 * @method wfWorkflowWorkItem getObject() Returns the current form's model object
 *
 * @package    Wildlive
 * @subpackage form
 * @author     Maximilian Lenkeit <dev@lenki.com>
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BasewfWorkflowWorkItemForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                   => new sfWidgetFormInputHidden(),
      'workflow_instance_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('WorkflowInstance'), 'add_empty' => true)),
      'user_id'              => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'member_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Member'), 'add_empty' => true)),
      'step_identifier'      => new sfWidgetFormInputText(),
      'class'                => new sfWidgetFormInputText(),
      'completed_at'         => new sfWidgetFormInputText(),
      'is_read'              => new sfWidgetFormInputCheckbox(),
      'created_at'           => new sfWidgetFormInputText(),
      'updated_at'           => new sfWidgetFormInputText(),
      'deleted_at'           => new sfWidgetFormDateTime(),
      'created_by'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'add_empty' => true)),
      'updated_by'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'add_empty' => true)),
      'deleted_by'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Deletor'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'id'                   => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'workflow_instance_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('WorkflowInstance'), 'required' => false)),
      'user_id'              => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'required' => false)),
      'member_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Member'), 'required' => false)),
      'step_identifier'      => new sfValidatorString(array('max_length' => 255, 'required' => false)),
      'class'                => new sfValidatorString(array('max_length' => 50)),
      'completed_at'         => new sfValidatorPass(array('required' => false)),
      'is_read'              => new sfValidatorBoolean(array('required' => false)),
      'created_at'           => new sfValidatorPass(array('required' => false)),
      'updated_at'           => new sfValidatorPass(array('required' => false)),
      'deleted_at'           => new sfValidatorDateTime(array('required' => false)),
      'created_by'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Creator'), 'required' => false)),
      'updated_by'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Updator'), 'required' => false)),
      'deleted_by'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Deletor'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('wf_workflow_work_item[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'wfWorkflowWorkItem';
  }

}
